package luogu;

import java.util.Scanner;

public class Main19 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int count = 0 ;
        StringBuilder sb = new StringBuilder();
        for (int i = x; i <=y ; i++) {
            if (((i % 4 == 0 && i % 100 != 0) || (i % 400 == 0))){
                count++;
                sb.append(i).append(" ");
            }
        }
        System.out.println(count);
        if (count>0){
            sb.deleteCharAt(sb.length()-1);
            System.out.println(sb);
            
        }else {
            System.out.println();
        }
    }
}
